//index.js
//获取应用实例
var app = getApp()
Page({ 
  data: {
    motto: 'Hello World',
    userInfo: {},
    serviceItem: [],
    show_nav:"h_nav",
    _ism:-1

  },
  onshow:function(e){
    var that = this;
    //调用应用实例的方法获取全局数据
    that.setData({      
      show_nav: "h_nav"

    });
  },
  
  onLoad: function (e) { 
    console.log(e);
    var that = this;
    var _ism = wx.getStorageSync("_ism");
    var member_id = wx.getStorageSync("_hairdresser_id");
    var pages = getCurrentPages();
                  var prevPage = pages[pages.length - 2]; 
                  prevPage.setData({
                    show_nav: 'h_nav'
                  });
    //调用应用实例的方法获取全局数据
    that.setData({
      userInfo: wx.getStorageSync("userInfo"),
      _ism: _ism,
      show_nav: "h_nav",
      hid: member_id

    });

      wx.showLoading({
        title: '加载中',
      }),
      wx.request({
        url: app.globalData.api_url + "index.php?ac=hapi&ts=index",
        data: {
          ism: _ism,
          hid: member_id,
          orderStat: 0,
        },
        header: { 'content-type': 'application/json' },
        success: function (res) {
          wx.hideLoading();
          that.setData({ 
            orderList: res.data
          })
          console.log(res.data);
        }

      })
      , setTimeout(function () {
        wx.hideLoading()
      }, 3000)
  },
  show_nav:function(e){
    var that = this;
    that.setData({
      show_nav:'Haircut_nav'
    });
  }

})
